<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>编辑内容</title>
	<hdjs />
	<script type="text/javascript">
		$(function(){
			$('form').validate({
				{$validate}	
			})
		})
	</script>
	<js file='__PUBLIC__/Js/mod.article.js' />
	<css file="__PUBLIC__/Css/mod.welcome.css" />
	<css file="__PUBLIC__/Css/mod.base.css" />
</head>
<body>
	<form action="" method="post" enctype='multipart/form-data'>

		<div class="hd-title-header">
			<span>{$cname}</span>
			编辑内容
		</div>
		<div class="hd-menu-list">
			<ul>
				<if condition="$catType neq 4">
					<li>
						<a href="{:U('Article/index',array('cid'=>
							$field['category_cid']))}" >
							内容列表
						</a>
					</li>
				</if>
				<li class="active">
					<a href="javascript:;" >编辑内容</a>
				</li>
			</ul>
		</div>

		<div class="hd-tab">
			<ul class="hd-tab-menu">
				<li lab='base' class="active">
					<a href="#">基本配置</a>
				</li>
				<li lab='pic'>
					<a href="#">图集上传</a>
				</li>
			</ul>
			<div class="hd-tab-content">
				<div lab='base' class="hd-tab-area">

					<table class='hd-table hd-table-form hd-form'>
						<tbody>

							<tr>
								<th class="w100">栏目分类</th>
								<td>
									<if condition="$catType neq 4">
										<select name="category_cid" >
											<option value="0">请选择分类</option>
											<option <if condition="$topid eq $field['category_cid']">selected='selected'</if>
											value="{$topid}">{$topname}
										</option>
										<foreach name='category' item='v'>
											<option <if condition="$v['cid'] eq $field['category_cid']">selected='selected'</if>
											{$v.disabled} value="{$v.cid}">---{$v._html}{$v.cname}
										</option>
									</foreach>
								</select>
								<else/>
								{$cname}
								<input type="hidden" name="category_cid" value="{$cid}" />
							</if>
						</td>
					</tr>
					<tr>
						<th class="w100">标题</th>
						<td>
							<input type="text" name="article_title"  class='hd-w350 title' value="{$field.article_title}"  />
						</td>
					</tr>

					<tr>
						<th>关键字</th>
						<td>
							<textarea name="keywords" class='hd-w500 hd-h100'>{$field.keywords}</textarea>
						</td>
					</tr>

					<tr>
						<th>描述</th>
						<td>
							<textarea name="description" class='hd-w500 hd-h100'>{$field.description}</textarea>
						</td>
					</tr>

					<tr>
						<th>排序</th>
						<td>
							<input name="sort" type="text" class='hd-w200'  value="{$field.sort}" />
						</td>
					</tr>
					<tr>
						<th>次数</th>
						<td>
							<input name="click" type="text" class='hd-w200'  value="{$field.click}" />
						</td>
					</tr>
					<tr>
						<th>发布时间</th>
						<td>
							<input name="addtime" id='addtime' type="text" class='hd-w200' value="{$field.addtime|date='Y-m-d',###}"/>
							<script>
								$('#addtime').calendar({
									format : 'yyyy-MM-dd'
								});
							</script>
						</td>
					</tr>
					<tr>
						<th>审核</th>
						<td>
							<label >
								<input <if condition="$field['verifystate'] eq 1">checked="checked"</if>
							name="verifystate" type="radio"  value="1" /> 审核中
						</label>
						<label >
							<input <if condition="$field['verifystate'] eq 2">checked="checked"</if>
						name="verifystate" type="radio" value="2" /> 通过
					</label>
				</td>
			</tr>
			<tr>
				<th>属性</th>
				<td>

					<foreach name='flag' item='v'>
						<label >
							<input <if condition="strchr($field['flag'],$v)">checked='checked'</if>
						name="flag[]" type="checkbox"  value="{$v}" /> {$v}({$key})
					</label>
				</foreach>

			</td>
		</tr>
		<tr>
			<th>图片</th>
			<td>
				<input type="file" name='pic'/>
				<br/>
				<img src="{$field.pic}" alt=""  width="100" />
				<if condition='$field["has_pic"]'>
					<a href="javascript:;" onclick="del_attachment(this,'{$field.aid}','pic')">删除</a>
				</if>
			</td>
		</tr>
		<tr >
			<th>文件</th>
			<td>
				<input type="file" name='file'/>
				<br/>
				<if condition ="$field['file']">
					<a href="{$field.downurl}">下载</a>
				</if>
				<if condition='$field["has_file"]'>
					<a href="javascript:;" onclick="del_attachment(this,'{$field.aid}','file')">删除</a>
				</if>
			</td>
		</tr>

		<foreach name='extForm' item='v'>
			<tr>
				<th>{$v.title}</th>
				<td>{$v.html}</td>
			</tr>
		</foreach>
		<if condition='$attrForm'>
			<tr>
				<th align='left' colspan='2'>筛选</th>
			</tr>
			<foreach name='attrForm' item='v'>
				<tr>
					<th>{$v.title}</th>
					<td>{$v.html}</td>
				</tr>
			</foreach>
		</if>
	</tbody>
</table>
</div>
<div lab='pic'  class="hd-tab-area" id='pic'> 
<if condition='!$attrPicCount'>
	<ul class='one_pic'>
		<foreach name='pics' item='p'>
			<li>
				<img src="{$p.big}" alt=""  width="100" />
				<p>{$p.pic_title}</p>
				<span rel="{$p.id}" onclick='del_img(this)'>×</span>
			</li>
		</foreach>
	</ul>

	<table cellpadding="0" cellspacing="0" class='hd-table-form hd-table hd-form'>
		<tr>
			<th width="20">
				<span class='hand' onclick='add_pic(this)'>[+]</span>
			</th>
			<td width="50">
				<input type="file" name="img[]" class="input noborder" />
			</td>
			<td>
				<input type="text" name="pic_title[]" class="input" />
			</td>
		</tr>

	</table>
	<else />

	<div class="color">

		<ul class="color_menu">
			<foreach name='pics' item='attr'>
				<li lab='attr{$attr.attr_value_id}' >
					<a href="#" >{$attr.attr_value}</a>
				</li>
			</foreach>
		</ul>

		<div class="color_content">

			<foreach name='pics' item='attr'>
				<div id='attr{$attr.attr_value_id}'>

					<ul class='one_pic'>
						<foreach name='attr.pics' item='p'>
							<li>
								<img src="{$p.big}" alt=""  width="100" />
								<p>{$p.pic_title}</p>
								<span rel="{$p.id}" onclick='del_img(this)'>×</span>
							</li>
						</foreach>
					</ul>
					<table class='hd-table hd-table-form hd-form'>
						<tr>
							<th width="20">
								<span class='hand' onclick='add_pic(this)'>[+]</span>
							</th>
							<td >
								<input type="file" name="img{$attr.attr_value_id}[]" class="input noborder" />
							</td>
							<td style='display:none'>
								<input type="text" name="pic_title{$attr.attr_value_id}[]" class="input" />
							</td>
						</tr>
					</table>
				</div>
			</foreach>

		</div>
		<input type='hidden' name='attrPic' value='1' />
	</div>

</if>
</div>
</div>
</div>

<div class="hd-position-bottom">
<input type="hidden" name="aid" value="{$field.aid}" />
<input type="submit" class='hd-btn-primary hd-btn' value="编辑" />
<input type="button" class="hd-btn" onclick="location.href='{:U('Article/index',array('cid'=>$field['category_cid']))}'" value="返回"/></div>
</form>

</body>
</html>